<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- this line will appear only if the website is visited with an iPad -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.2, user-scalable=yes" />

    <!-- Touch icons more info: http://mathiasbynens.be/notes/touch-icons -->
    <!-- For iPad3 with retina display: -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144x.png" />
    <!-- For first- and second-generation iPad: -->
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x.png" />
    <!-- For first- and second-generation iPad: -->
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x.png" />
    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
    <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-57x.png" />
    <!-- [favicon] end -->

    <!-- CSSs -->
    <link rel="stylesheet" type="text/css" media="all" href="/static/home/css/reset.css" /> <!-- RESET STYLESHEET -->
    <!--<link rel="stylesheet" type="text/css" media="all" href="/static/home/css/style.css" /> &lt;!&ndash; MAIN THEME STYLESHEET &ndash;&gt;-->
    <link rel="stylesheet" id="max-width-1024-css" href="/static/home/css/max-width-1024.css" type="text/css" media="screen and (max-width: 1240px)" />
    <link rel="stylesheet" id="max-width-768-css" href="/static/home/css/max-width-768.css" type="text/css" media="screen and (max-width: 987px)" />
    <link rel="stylesheet" id="max-width-480-css" href="/static/home/css/max-width-480.css" type="text/css" media="screen and (max-width: 480px)" />
    <link rel="stylesheet" id="max-width-320-css" href="/static/home/css/max-width-320.css" type="text/css" media="screen and (max-width: 320px)" />

    <!-- CSSs Plugin -->
    <!--<link rel="stylesheet" id="thickbox-css" href="/static/home/css/thickbox.css" type="text/css" media="all" />-->
    <link rel="stylesheet" id="styles-minified-css" href="/static/home/css/style-minifield.css" type="text/css" media="all" />
    <link rel="stylesheet" id="buttons" href="/static/home/css/buttons.css" type="text/css" media="all" />
    <link rel="stylesheet" id="cache-custom-css" href="/static/home/css/cache-custom.css" type="text/css" media="all" />
    <!--<link rel="stylesheet" id="custom-css" href="/static/home/css/custom.css" type="text/css" media="all" />-->

    <link rel="stylesheet" type="text/css" href="/static/back/plugins/forms/validate/validate.css"  />

</head>
<body>
    <div class="inner group">
        <div id="respond" >
            <form action="javascript:void(0);" method="post" id="form-comment-reply" data-action="{:url('back/Comment/addProcess')}" data-id="{$id}">
                {if condition="$login"}
                {else/}
                <p class="comment-form-author">
                    <label for="form-nickname">昵称</label>
                    <input id="nickname" name="nickname" type="text" value="" size="30" aria-required="true" id="form-nickname"/>
                </p>
                <p class="comment-form-email">
                    <label for="form-email">邮箱</label>
                    <input id="email" name="email" type="text" value="" size="30" aria-required="true" id="form-email"/>
                </p>
                <p class="comment-form-url">
                    <label for="form-website">网站</label>
                    <input id="website" name="website" type="text" value="" size="30" id="form-website"/>
                </p>
                {/if}
                <p class="comment-form-comment" >
                    <label for="form-comment">{$login?'来自<span style="color:#A05F02;">'.$login.nickname.'</span>的':'匿名'}评论</label>
                    <textarea id="form-comment" name="comment" cols="45" rows="8"></textarea>
                </p>
                <div class="clear"></div>
                <p class="form-submit">
                    <button class="btn" name="submit" type="submit" id="submit" value="reply">发表评论</button>
                </p>
            </form>
        </div>
        <div style="clear:both;"></div>
    </div>

    <script type="text/javascript" src="/static/back/js/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/back/plugins/forms/validate/jquery.validate.js"></script>
    <script type="text/javascript" src="/static/back/plugins/forms/wizard/jquery.form.js"></script>
    <script type="text/javascript" src="/static/back/plugins/layer/layer.js"></script>
    <script type="text/javascript">
        jQuery("#form-comment-reply").validate({
            rules:{
                comment: {
                    required: true,
                    minlength: 2
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                jQuery(form).ajaxSubmit({
                    type:'post',
                    url: jQuery(form).data('action'),
                    dataType: 'json',
                    data:{ // 传递父ID
                        pid:jQuery(form).data('id')
                    },
                    success:function(response){
                        if (response.status == 'success') {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.msg('回复成功', {icon:1, time:10000});
                            setTimeout(function(){
                                parent.location.reload(); // 刷新页面
                                parent.layer.close(index);
                            },1200);
                        } else if ( response.status == 'failed') {
                            parent.layer.msg('回复失败',{icon:2, time:1000});
                        }
                    },error:function(data) {
                        layer.msg('必填参数不能为空', {icon:2,time:1000});
                    }
                });
            }
        });
    </script>
</body>
</html>